{% extends "base.html" %}
{% load compare %}

{% block extrahead %}
{{ block.super }}
<style type="text/css">
    .topscore {float: right;}
    .score {
        font-size: 24pt;
        text-align: center;
    }
    .points {
        font-size: 70pt;
        text-shadow: 0 0 19px #88F, 0 0 38px #448,0 0 75px black, 0 0 150px black;
    }
    .answer {
        padding: 0px 10px;
        border-top: 2px solid grey;
        margin-bottom: 4px;
    }
    .answers {border:2px solid; border-top: none; width: 100%;text-align: left;}
    .answers td, .answers th {padding-left: 5px; padding-right: 5px;}
    .question {}
    .useranswer {font-weight: bold;}
    .correct {
        color: #353;
    }
    .incorrect {
        color: #533;
    }
</style>
{% endblock %}

{% block content %}

<div class="topscore">
    <h3>Top Scores</h3>
    <ul>
        {% for top in topscores %}<li><strong>{{ top.total_score }}</strong> {{ top.name }}</li>
        {% endfor %}
    </ul>
</div>
<div class="score">
    You scored
    <div class="points">{{ session.total_score }}</div>
    point{{ session.total_score|pluralize }}!
    <div class="rank">
        You score is rank #{{ rank }} of {{ total_plays }}
    </div>
    <a href="{% url quiz-intro session.quiz.slug %}">Restart</a>
</div>
<table class="answers">
    {% for response in session.answered %}
    <tr class="answer">
        <th colspan="3" class="question">{{ response.answered_on|date:"h:i:s a" }}:
        {{ response.question.content|striptags|safe }}</th></tr>
    </tr>
    {% for possible in response.userpossibleanswer_set.all %}
    <tr class="{% if possible.point_value|gt:0 %}correct{% else %}incorrect{% endif %} {% ifequal possible.possibleanswer.content response.answer %}useranswer{% endifequal %}">
        <td width="10">{% if possible.chosen %} &rsaquo; {% endif %}</td>
        <td>{{ possible.possibleanswer.content|safe }} ({{ possible.point_value }} points)</td>
        <td>{% if possible.chosen and possible.possibleanswer.explain %}
            {% ifequal possible.possibleanswer.question possible.useranswer.question %}
            {{ possible.possibleanswer.explaination }}
            {% endifequal %}
            {% endif %}
        </td>
    </tr>
    {% endfor %}
    {% endfor %}
</table>
{% endblock %}